'use strict';

let
    Koa = require('koa'),
    app = new Koa(),
    port = 7879,
    statics = require('koa-static'),
    middleWare = require('./tempMiddleWare'),
    bodyParser = require('koa-bodyparser'),
    controllers = require('./controllers'),
    model = require('./model'),
    session = require('koa-session');

app.keys = ['Are you OK?'];

app.use(session(app));

app.use(statics('.'));

app.use(statics(__dirname + '/statics'));

app.use(bodyParser());

app.use(middleWare);

app.use(controllers());


(async () => {
    // await model.sync();
})();

app.listen(port, () => {
    console.log(`http://localhost:${port}`);
})